using Microsoft.AspNetCore.Mvc;
using Infrastructure.Filters;
using ZR.Infrastructure;
using ZR.Service.BaseFrame.IService;
using ZR.Model.BaseFrame.Dto;
using ZR.Model.BaseFrame.Entity;
using ZR.Model;
using ZR.Admin.WebApi.MainModules;
using ZR.ServiceCore.Attributes;

namespace ZR.Admin.WebApi.Controllers.BaseFrame
{
    /// <summary>
    /// 操作日志
    /// </summary>
    public class OperLogControllerBase : ApiControllerBase
    {

        /// <summary>
        /// 操作日志接口
        /// </summary>
        protected readonly IOperLogService _OperLogService;

        protected readonly MapsterAdaptEntityCfg _mapsterAdaptEntityCfg;

        public OperLogControllerBase(IOperLogService operLogService, MapsterAdaptEntityCfg mapsterAdaptEntityCfg)
        {
            _OperLogService = operLogService;
            _mapsterAdaptEntityCfg = mapsterAdaptEntityCfg;
        }










        /// <summary>
        /// 查询操作日志分页列表
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        [HttpPost("pageList")]
        [ActionPermissionFilter(Permission = "operlog:list")]
        public virtual async Task<PagedInfo<OperLogListItemDto>> GetOperLogPageList([FromBody] GetOperLogPageListReq req)
        {
            var result = await _OperLogService.GetOperLogPageList(req);
            return result;
        }

        /// <summary>
        /// 查询操作日志详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("detail/{id}")]
        [ActionPermissionFilter(Permission = "operlog:detail")]
        public virtual async Task<OperLogDetailDto> GetOperLogDetail(long id)
        {
            var result = await _OperLogService.GetOperLogDetail(id);
            return result;
        }

    }
}